////////////////////////////////////////////////////////////////////////////
//
//  CryEngine Source File.
//  Copyright (C), Crytek, 1999-2010.
// -------------------------------------------------------------------------
//  File name:	AssetBrowserSearchDlg.h
//  Version:	v1.00
//  Created:	12/07/2010 by Nicusor Nedelcu
//  Description:	The dialog used for searching assets, contains the search editbox
// -------------------------------------------------------------------------  
//  History:
//
//////////////////////////////////////////////////////////////////////////// 

#ifndef __AssetBrowserSearchDlg_h__
#define __AssetBrowserSearchDlg_h__
#pragma once

#include <vector>
#include "Include/IAssetDisplay.h"
#include "Include/IAssetDisplayDatabase.h"
#include "Controls/ScrollableWindow.h"

class CAssetBrowserDialog;

#define ID_TIMER_SEARCH_BY_FILENAME 1

namespace AssetBrowser
{
	const UINT kSearchByFilenameTimerDelay = 150;
};

class CSearchEditCtrl : public CColoredEdit
{
public:

	CString m_defaultText;
	bool		m_bNotFound;

	CSearchEditCtrl();

	DECLARE_MESSAGE_MAP()
	afx_msg void OnEnSetfocus();
	afx_msg void OnEnKillfocus();
	afx_msg void OnEnUpdate();
};


// CAssetBrowserSearchDlg dialog

class CAssetBrowserSearchDlg : public CDialog
{
	DECLARE_DYNAMIC(CAssetBrowserSearchDlg)

public:


	CAssetBrowserSearchDlg(CWnd* pParent = NULL);   // standard constructor
	virtual ~CAssetBrowserSearchDlg();

// Dialog Data
	enum { IDD = IDD_ASSET_BROWSER_SEARCH_BAR };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	void HandleDebugCommand(const CString& command);

	DECLARE_MESSAGE_MAP()
public:

	CAssetBrowserDialog*								m_pAssetBrowserDlg;
	CSearchEditCtrl											m_edSearchText;
	CFont																m_fntSearchText;
	IAssetDisplayDatabase::TAssetFields	m_fields;
	bool																m_bForceFilterUsedInLevel, m_bForceShowFavourites, m_bForceHideLods;
	bool																m_bAllowOnlyFilenames;
	CString															m_allowedFilenames;

	virtual BOOL OnInitDialog();
	virtual void OnCancel();
	virtual void OnOK();

	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnEnChangeEditSearchText();
	afx_msg void OnTimer(UINT_PTR nIDEvent);
};

#endif //__AssetBrowserSearchDlg_h__
